package com.jackchong.bean

import com.jackchong.net.ActionModeEnum
import com.jackchong.net.JBaseData

/**
 * author : chong.huang
* create : 4/1/21
 * desc   :
 */
class JData<T> : JBaseData<T> {
    var code: Int = 0
    var msg: String? = null
    var success = false
    var data: T? = null

    override fun getNetAction(): ActionModeEnum {
        return when {
            success -> ActionModeEnum.SUCCESS
            else -> ActionModeEnum.FAILURE
        }
    }
    override fun code(): String = code.toString()

    override fun message(): String? = msg

    override fun data(): T? = data
}